<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Protocols  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset="utf-8">
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>
    
    <script src="js/lunr.min.js" defer></script>
    <script src="js/typeahead.jquery.js" defer></script>
    <script src="js/jazzy.search.js" defer></script>
  </head>
  <body>

    <a name="//apple_ref/swift/Section/Protocols" class="dashAnchor"></a>

    <a title="Protocols  Reference"></a>

    <header class="header">
      <p class="header-col header-col--primary">
        <a class="header-link" href="index.html">
          Katana 5.1.1 Docs
        </a>
         (99% documented)
      </p>
    
      <p class="header-col--secondary">
        <form role="search" action="search.json">
          <input type="text" placeholder="Search documentation" data-typeahead>
        </form>
      </p>
    
        <p class="header-col header-col--secondary">
          <a class="header-link" href="https://github.com/BendingSpoons/katana-swift">
            <img class="header-icon" src="img/gh.png"/>
            View on GitHub
          </a>
        </p>
    
    </header>

    <p class="breadcrumbs">
      <a class="breadcrumb" href="index.html">Katana Reference</a>
      <img class="carat" src="img/carat.png" />
      Protocols  Reference
    </p>

    <div class="content-wrapper">
      <nav class="navigation">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/EmptySideEffectDependencyContainer.html">EmptySideEffectDependencyContainer</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/PartialStore.html">PartialStore</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/Store.html">Store</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/Store/Configuration.html">– Configuration</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Enums.html">Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/DispatchableLogger.html">DispatchableLogger</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Extensions/DispatchQueue.html">DispatchQueue</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/AnySideEffect.html">AnySideEffect</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/AnySideEffectContext.html">AnySideEffectContext</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/AnyStateUpdater.html">AnyStateUpdater</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/AnyStore.html">AnyStore</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/AsyncProvider.html">AsyncProvider</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/DispatchObserverDispatchable.html">DispatchObserverDispatchable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/Dispatchable.html">Dispatchable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/NotificationObserverDispatchable.html">NotificationObserverDispatchable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/OnStartObserverDispatchable.html">OnStartObserverDispatchable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/ReturningSideEffect.html">ReturningSideEffect</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/SideEffect.html">SideEffect</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/SideEffectDependencyContainer.html">SideEffectDependencyContainer</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/State.html">State</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/StateObserverDispatchable.html">StateObserverDispatchable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/StateUpdater.html">StateUpdater</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/ObserverInterceptor.html">ObserverInterceptor</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/ObserverInterceptor/ObserverType.html">– ObserverType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/SideEffectContext.html">SideEffectContext</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/SignpostLogger.html">SignpostLogger</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Typealiases.html#/s:6Katana11AnyDispatcha">AnyDispatch</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Typealiases.html#/s:6Katana16AnyStoreListenera">AnyStoreListener</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Typealiases.html#/s:6Katana8GetStatea">GetState</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Typealiases.html#/s:6Katana16StoreInterceptora">StoreInterceptor</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Typealiases.html#/s:6Katana20StoreInterceptorNexta">StoreInterceptorNext</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Typealiases.html#/s:6Katana13StoreListenera">StoreListener</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Typealiases.html#/s:6Katana16StoreUnsubscribea">StoreUnsubscribe</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">

        <section class="section">
          <div class="section-content top-matter">
            <h1>Protocols</h1>
            <p>The following protocols are available globally.</p>

          </div>
        </section>

        <section class="section">
          <div class="section-content">
            <div class="task-group">
              <ul class="item-container">
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana12DispatchableP"></a>
                    <a name="//apple_ref/swift/Protocol/Dispatchable" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana12DispatchableP">Dispatchable</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol that marks something that can be actually dispatched into the <code><a href="Classes/Store.html">Store</a></code>.
It doesn&rsquo;t have any particular requirement, and the protocol is actually used to
simply mark a category of items. Currently the <code><a href="Classes/Store.html">Store</a></code> is able to manage 2 types
of <code>Dispatchable</code>: <code><a href="Protocols/SideEffect.html">SideEffect</a></code>, <code><a href="Protocols/StateUpdater.html">StateUpdater</a></code>.</p>

                        <a href="Protocols/Dispatchable.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Dispatchable</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/Dispatchable.swift#L17">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana32NotificationObserverDispatchableP"></a>
                    <a name="//apple_ref/swift/Protocol/NotificationObserverDispatchable" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana32NotificationObserverDispatchableP">NotificationObserverDispatchable</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol implemented by a dispatchable that wants to be dispatched in response to a notification</p>

                        <a href="Protocols/NotificationObserverDispatchable.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">NotificationObserverDispatchable</span> <span class="p">:</span> <span class="kt"><a href="Protocols/Dispatchable.html">Dispatchable</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/Interceptor/ObserverInterceptor.swift#L15-L25">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana25StateObserverDispatchableP"></a>
                    <a name="//apple_ref/swift/Protocol/StateObserverDispatchable" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana25StateObserverDispatchableP">StateObserverDispatchable</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol implemented by a dispatchable that wants to be dispatched in response to a change of the state</p>

                        <a href="Protocols/StateObserverDispatchable.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">StateObserverDispatchable</span> <span class="p">:</span> <span class="kt"><a href="Protocols/Dispatchable.html">Dispatchable</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/Interceptor/ObserverInterceptor.swift#L30-L41">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana28DispatchObserverDispatchableP"></a>
                    <a name="//apple_ref/swift/Protocol/DispatchObserverDispatchable" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana28DispatchObserverDispatchableP">DispatchObserverDispatchable</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol implemented by a dispatchable that wants to be dispatched in response to the dispatch of another dispatchable</p>

                        <a href="Protocols/DispatchObserverDispatchable.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DispatchObserverDispatchable</span> <span class="p">:</span> <span class="kt"><a href="Protocols/Dispatchable.html">Dispatchable</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/Interceptor/ObserverInterceptor.swift#L46-L58">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana27OnStartObserverDispatchableP"></a>
                    <a name="//apple_ref/swift/Protocol/OnStartObserverDispatchable" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana27OnStartObserverDispatchableP">OnStartObserverDispatchable</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol implemented by a dispatchable that wants to be dispatched when the store starts</p>

                        <a href="Protocols/OnStartObserverDispatchable.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">OnStartObserverDispatchable</span> <span class="p">:</span> <span class="kt"><a href="Protocols/Dispatchable.html">Dispatchable</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/Interceptor/ObserverInterceptor.swift#L63-L72">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana20AnySideEffectContextP"></a>
                    <a name="//apple_ref/swift/Protocol/AnySideEffectContext" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana20AnySideEffectContextP">AnySideEffectContext</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Type erasure for <code><a href="Structs/SideEffectContext.html">SideEffectContext</a></code></p>
<div class="aside aside-see-also">
    <p class="aside-title">See also</p>
    <code><a href="Structs/SideEffectContext.html">SideEffectContext</a></code>

</div>

                        <a href="Protocols/AnySideEffectContext.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">AnySideEffectContext</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/SideEffect.swift#L17-L65">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana13AnySideEffectP"></a>
                    <a name="//apple_ref/swift/Protocol/AnySideEffect" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana13AnySideEffectP">AnySideEffect</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Type erasure for <code><a href="Protocols/SideEffect.html">SideEffect</a></code> and <code><a href="Protocols/ReturningSideEffect.html">ReturningSideEffect</a></code></p>
<div class="aside aside-see-also">
    <p class="aside-title">See also</p>
    <code><a href="Protocols/SideEffect.html">SideEffect</a></code>, <code><a href="Protocols/ReturningSideEffect.html">ReturningSideEffect</a></code>

</div>

                        <a href="Protocols/AnySideEffect.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">AnySideEffect</span> <span class="p">:</span> <span class="kt"><a href="Protocols/Dispatchable.html">Dispatchable</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/SideEffect.swift#L157-L166">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana19ReturningSideEffectP"></a>
                    <a name="//apple_ref/swift/Protocol/ReturningSideEffect" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana19ReturningSideEffectP">ReturningSideEffect</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A <code><a href="Protocols/AnySideEffect.html">AnySideEffect</a></code> that is capable of returning a typed value.</p>

<p>In order to promote reusability of the logic written using this type, both the state and
the dependencies are erased. This helps tremendously when writing libraries and generic
logic, and it can also be extended to be used in the apps.</p>

<p>For example, if the app needs to use a typed returning side effect it can define something like:</p>
<pre class="highlight swift"><code><span class="kd">protocol</span> <span class="kt">AppReturningSideEffect</span><span class="p">:</span> <span class="kt">ReturningSideEffect</span> <span class="p">{</span>
  <span class="kd">typealias</span> <span class="kt">StateType</span> <span class="o">=</span> <span class="kt">AppState</span>
  <span class="kd">typealias</span> <span class="kt">Dependencies</span> <span class="o">=</span> <span class="kt">AppDependencies</span>

  <span class="kd">func</span> <span class="nf">sideEffect</span><span class="p">(</span><span class="n">_</span> <span class="nv">context</span><span class="p">:</span> <span class="kt">SideEffectContext</span><span class="o">&lt;</span><span class="kt">StateType</span><span class="p">,</span> <span class="kt">Dependencies</span><span class="o">&gt;</span><span class="p">)</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">ReturnType</span>
<span class="p">}</span>

<span class="kd">extension</span> <span class="kt">AppReturningSideEffect</span> <span class="p">{</span>
  <span class="kd">func</span> <span class="nf">sideEffect</span><span class="p">(</span><span class="n">_</span> <span class="nv">context</span><span class="p">:</span> <span class="kt">AnySideEffectContext</span><span class="p">)</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">ReturnValue</span> <span class="p">{</span>
    <span class="k">guard</span> <span class="k">let</span> <span class="nv">typedContext</span> <span class="o">=</span> <span class="n">context</span> <span class="k">as?</span> <span class="kt">SideEffectContext</span><span class="o">&lt;</span><span class="kt">StateType</span><span class="p">,</span> <span class="kt">Dependencies</span><span class="o">&gt;</span> <span class="k">else</span> <span class="p">{</span>
      <span class="nf">fatalError</span><span class="p">(</span><span class="s">"Invalid context passed to side effect"</span><span class="p">)</span>
    <span class="p">}</span>

    <span class="k">return</span> <span class="k">try</span> <span class="k">self</span><span class="o">.</span><span class="nf">sideEffect</span><span class="p">(</span><span class="n">typedContext</span><span class="p">)</span>
  <span class="p">}</span>
<span class="p">}</span>
</code></pre>
<div class="aside aside-see-also">
    <p class="aside-title">See also</p>
    <code><a href="Protocols/AnySideEffect.html">AnySideEffect</a></code>, <code><a href="Protocols/SideEffect.html">SideEffect</a></code>

</div>

                        <a href="Protocols/ReturningSideEffect.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ReturningSideEffect</span> <span class="p">:</span> <span class="kt"><a href="Protocols/AnySideEffect.html">AnySideEffect</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/SideEffect.swift#L198-L210">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana10SideEffectP"></a>
                    <a name="//apple_ref/swift/Protocol/SideEffect" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana10SideEffectP">SideEffect</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A side effect is a single atom of the logic of your application.
While you can actually use them as you desire, the idea is to implement in each side effect
a meaningful, self contained, piece of logic that can be used from other pieces of you application
(e.g., dispatched by a View Controller or by another side effect).</p>

<p>The <code>SideEffect</code> is strongly tied to the state that it handles and the dependencies it has.
This greatly simplifies the code written in normal situations.
However, if you need to create updaters that are not strictly tied to a concrete types (e.g., in a library)
you can use <code><a href="Protocols/AnySideEffect.html">AnySideEffect</a></code>.</p>
<h3 id='app-tips-amp-tricks' class='heading'>App Tips &amp; Tricks</h3>

<p>To further simplify the usage of a <code>SideEffect</code> you can add to your application a helper protocol</p>
<pre class="highlight swift"><code><span class="c1">/// assuming `AppState` is the type of your application's state and `DependenciesContainer` is the</span>
<span class="c1">/// container of your dependencies</span>
<span class="kd">protocol</span> <span class="kt">AppSideEffect</span><span class="p">:</span> <span class="kt">SideEffect</span> <span class="k">where</span> <span class="kt">StateType</span> <span class="o">==</span> <span class="kt">AppState</span><span class="p">,</span> <span class="kt">Dependencies</span> <span class="o">==</span> <span class="kt">DependenciesContainer</span> <span class="p">{}</span>
</code></pre>

<p>By conforming to <code>AppSideEffect</code>, you will get better autocompletion</p>

                        <a href="Protocols/SideEffect.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SideEffect</span> <span class="p">:</span> <span class="kt"><a href="Protocols/AnySideEffect.html">AnySideEffect</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/SideEffect.swift#L241-L281">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana29SideEffectDependencyContainerP"></a>
                    <a name="//apple_ref/swift/Protocol/SideEffectDependencyContainer" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana29SideEffectDependencyContainerP">SideEffectDependencyContainer</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol that the side effect dependencies container should implement</p>

                        <a href="Protocols/SideEffectDependencyContainer.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SideEffectDependencyContainer</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/SideEffectDependencyContainer.swift#L13-L23">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana5StateP"></a>
                    <a name="//apple_ref/swift/Protocol/State" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana5StateP">State</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol for the state of the applications.
In Katana, all the relevant application information should be placed in a single
struct that has to implement the <code>State</code> protocol.</p>

                        <a href="Protocols/State.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">State</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/State.swift#L16-L22">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana15AnyStateUpdaterP"></a>
                    <a name="//apple_ref/swift/Protocol/AnyStateUpdater" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana15AnyStateUpdaterP">AnyStateUpdater</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Type erasure for <code><a href="Protocols/StateUpdater.html">StateUpdater</a></code></p>
<div class="aside aside-see-also">
    <p class="aside-title">See also</p>
    <code><a href="Protocols/StateUpdater.html">StateUpdater</a></code>

</div>

                        <a href="Protocols/AnyStateUpdater.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">AnyStateUpdater</span> <span class="p">:</span> <span class="kt"><a href="Protocols/Dispatchable.html">Dispatchable</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/StateUpdater.swift#L16-L24">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana12StateUpdaterP"></a>
                    <a name="//apple_ref/swift/Protocol/StateUpdater" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana12StateUpdaterP">StateUpdater</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A <code>StateUpdater</code> is a <code><a href="Protocols/Dispatchable.html">Dispatchable</a></code> that can be used to update the <code><a href="Classes/Store.html">Store</a></code>
state configuration.</p>

<p>The <code>StateUpdater</code> is strongly tied to the state that it handles. This greatly simplifies
the code written in normal situations. However, if you need to create updaters that are not strictly
tied to a concrete state type (e.g., in a library) you can use <code><a href="Protocols/AnyStateUpdater.html">AnyStateUpdater</a></code>.</p>
<h3 id='app-tips-amp-tricks' class='heading'>App Tips &amp; Tricks</h3>

<p>To additionally simplify the usage of a <code>StateUpdater</code> you can add to your application an helper protocol</p>
<pre class="highlight swift"><code><span class="c1">/// assuming `AppState` is the type of your application's state</span>
<span class="kd">protocol</span> <span class="kt">AppStateUpdater</span><span class="p">:</span> <span class="kt">StateUpdater</span> <span class="k">where</span> <span class="kt">StateType</span> <span class="o">==</span> <span class="kt">AppState</span> <span class="p">{}</span>
</code></pre>

<p>By conforming to <code>AppStateUpdater</code>, you will get better autocompletion</p>

                        <a href="Protocols/StateUpdater.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">StateUpdater</span> <span class="p">:</span> <span class="kt"><a href="Protocols/AnyStateUpdater.html">AnyStateUpdater</a></span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/StateUpdater.swift#L43-L58">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana8AnyStoreP"></a>
                    <a name="//apple_ref/swift/Protocol/AnyStore" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana8AnyStoreP">AnyStore</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Type Erasure for <code><a href="Classes/Store.html">Store</a></code></p>

                        <a href="Protocols/AnyStore.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">AnyStore</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/Store.swift#L13-L63">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:6Katana13AsyncProviderP"></a>
                    <a name="//apple_ref/swift/Protocol/AsyncProvider" class="dashAnchor"></a>
                    <a class="token" href="#/s:6Katana13AsyncProviderP">AsyncProvider</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Entity capable of executing task asynchronously. This can be useful in tests to control asynchronous tasks</p>

                        <a href="Protocols/AsyncProvider.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">AsyncProvider</span></code></pre>

                        </div>
                      </div>
                      <div class="slightly-smaller">
                        <a href="https://github.com/BendingSpoons/katana-swift/blob/master//Sources/Types.swift#L38-L41">Show on GitHub</a>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </section>

      </article>
    </div>
    <section class="footer">
      <p>&copy; 2021 <a class="link" href="http://bendingspoons.com" target="_blank" rel="external">Bending Spoons Team</a>. All rights reserved. (Last updated: 2021-04-29)</p>
      <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
    </section>
  </body>
</div>
</html>
